import { createSSRApp } from "vue";
import App from "./App";
import store from "./store";
// import uviewPlus from 'uview-plus'
import uviewPlus from "uview-plus";

import "./common/http.js";
import api from "./common/api/api.js";

import * as echarts from "echarts";

import { goBack } from "./common/util.js";

export function createApp() {
  const app = createSSRApp(App);

  app.use(uviewPlus);
  app.use(store);

  app.config.globalProperties.$api = api;
  app.config.globalProperties.$store = store;
  app.config.globalProperties.$goBack = goBack;
  app.config.globalProperties.$echarts = echarts;
  app.config.globalProperties.$baseUrl =
    process.env.NODE_ENV === "development" ? "/api" : "";
  app.config.globalProperties.$baseUrl = console.log(
    "app.config.$baseUrl===>",
    app.config.globalProperties.$baseUrl
  );

  //---企业--//
  app.config.globalProperties.$adpid = "1111111111";
  app.config.globalProperties.$backgroundAudioData = {
    playing: false,
    playTime: 0,
    formatedPlayTime: "00:00:00",
  };

  return {
    app,
  };
}
